package com.derbysoft.ota.application.util;

import com.derbysoft.ota.application.translator.CodeTables;
import com.derbysoft.ota.interfaces.protocol._2009a.UniqueIDType;
import com.derbysoft.ota.interfaces.protocol._2009a.HotelReservationIDsType.HotelReservationID;
import com.google.common.base.Predicate;

public abstract class UniqueIDTypes {

	public static Predicate<UniqueIDType> ersp() {
		return predicateOf(CodeTables.UIT_ERSP);
	}

	public static Predicate<HotelReservationID> reservation() {
		return new Predicate<HotelReservationID>() {
			public boolean apply(HotelReservationID input) {
				return CodeTables.UIT_RESERVATION.equals(input.getResIDType());
			}
		};
	}
	
	private static Predicate<UniqueIDType> predicateOf(final String uniqueId) {
		return new Predicate<UniqueIDType>() {
			public boolean apply(UniqueIDType input) {
				return uniqueId.equals(input.getType());
			}
		};
	}

}
